/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package othello.logic;

import java.awt.Point;
import java.util.Random;
import othello.UI.GameFrame;

/**
 *
 * @author sa11
 * AI spelare som väljer ut ett de godkända dragen helt slumpmässigt.
 */
public class Computer extends Player {

    @Override
    public Point getMove( GameGrid gamegrid) {
        try {
            Thread.sleep(GameFrame.getSpeed());
        } catch (InterruptedException ex) {
            System.out.println("Sleep error in "+this);
        }
      
        Point move = new Point();

        Random r = new Random();
        int i = r.nextInt(gamegrid.getValidMoves(this.getID()).size());
        Point move1 = (Point) gamegrid.getValidMoves(this.getID()).get(i);

        move.setLocation(move1.getX(), move1.getY());
        return move;

    }
}
